home *** CD-ROM | disk | FTP | other *** search
-
- //
- // Description:
- // Deformation tools. Uses ENUMSELECTLIST() layer method to enumerate
- // selected objects to a user specific callback function. Uses GETPOINT() and SETPOINT()
- // methods to deform the geometry.
- //
- // Super class:
- // myclasses/toolbars/toolbar.js
- //
- // Constructor:
- // toolbar = new myDeformationTools();
- //
- // Attributes:
- // --
- //
- // Methods:
- // --
- //
-
- include("myclasses/toolbars/mytoolbar.js"); // super class
- include("real/objects/r3prim.js");
- include("real/layer/r3prilay.js");
-
- // geometric objects
-
- function myNoiseCallback(r3obj, data)
- {
- obj = R3ToJS(r3obj);
- if(!obj)
- return 0;
- p = new r3Vect();
- pcount = obj.GetPointCount();
-
- for(i = 0; i < pcount; i++) {
- obj.GETPOINT(p, i);
- p2 = p.noise(3, 3);
- p2.fmul(0.1);
- obj.SETPOINT(i, p2);
- }
- return 1;
- }
-
- function mydfrmNoise(button, event, value)
- {
- button.layer.LOCKEXCLUSIVE(0);
- button.layer.ENUMSELECTLIST([R3RA_Hook, myNoiseCallback,
- R3PLAYA_Recursive, TRUE]);
- button.layer.RELEASE(0);
- button.layer.CHANGED([R3PRIMM_SETPOINT, 0]);
- }
-
- function myDeformationTools(orientation)
- {
- if(arguments.length == 0)
- return;
-
- // create JavaScript interface for accessing geometric objects layer
- primLayer = GetJS("CurrentProject.Geometrics");
-
- // let the super class to do its job
- this.base = myToolBar;
- this.base("Deformation Tools", VERTICAL, primLayer);
-
- // Add tool buttons.
- this.AddTool("Noise", mydfrmNoise);
- }
-
- myDeformationTools.prototype=new myToolBar;
-